package me.shiqiang.im.service;


import me.shiqiang.im.redis.RedisKey;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @author cuishiqiang
 * @date 2018/6/22 下午3:24
 */
@Service
public class SensitiveService {


    @Autowired
    StringRedisTemplate template;

    public String getVersion() {
        String version = template.opsForValue().get(RedisKey.SENSITIVE_VERSION);
        if (StringUtils.isBlank(version)) {
            version = "0";
        }
        return version;
    }

    public void updateVersion() {
        template.opsForValue().increment(RedisKey.SENSITIVE_VERSION, 1);
    }
}
